This file is part of the supplementary material of the manuscript: Didino, D., Brandtner, M., & Knops, A. (2021). No influence of masked priming on the multiplication fact retrieval in a result verification task.
This script run the data pre-processing of experiment 3.
Dataset loaded: exp_soa_2_data.csv (data of result verification task)
Load libraries and data:
library('tidyverse')
#> -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
#> v ggplot2 3.3.5 v purrr 0.3.4
#> v tibble 3.1.0 v dplyr 1.0.5
#> v tidyr 1.1.3 v stringr 1.4.0
#> v readr 1.4.0 v forcats 0.5.1
#> -- Conflicts ------------------------------------------ tidyverse_conflicts() --
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag() masks stats::lag()
library('here')
#> here() starts at D:/mult_prime
library('janitor')
#>
#> Attaching package: 'janitor'
#> The following objects are masked from 'package:stats':
#>
#> chisq.test, fisher.test
library('plotly')
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
# library('knitr')
library('kableExtra')
#>
#> Attaching package: 'kableExtra'
#> The following object is masked from 'package:dplyr':
#>
#> group_rows
# Load my functions
source(here('funcs', 'load_my_functions.R'))
# Load data (included )
exp3_rowData <- read_csv(here('data', 'rawdata', 'exp_soa_2_data.csv'))
#>
#> -- Column specification --------------------------------------------------------
#> cols(
#> sj = col_character(),
#> age = col_double(),
#> gender = col_character(),
#> op1 = col_double(),
#> op2 = col_double(),
#> probe = col_double(),
#> product = col_double(),
#> prime = col_double(),
#> filler = col_double(),
#> probe_type = col_character(),
#> prime_type = col_character(),
#> prime_decade_consistency = col_character(),
#> prime_cond = col_character(),
#> SOA = col_character(),
#> acc = col_double(),
#> RT = col_double(),
#> block = col_double(),
#> problem_size = col_character(),
#> timing = col_character()
#> )
Plot accuracy by subject
plot_acc_sj <-
exp3_rowData %>%
group_by(sj) %>%
summarise(acc = mean(acc)) %>%
ggplot(aes(x = acc, y = sj)) +
geom_point() +
coord_cartesian(xlim = c(0, 1)) +
geom_vline(xintercept = 0.75,
linetype = 'dashed',
color = 'red',
size = 1)
ggplotly(plot_acc_sj)
Plot accuracy by block and subject
plot_acc_block_sj <-
exp3_rowData %>%
group_by(sj, block) %>%
summarise(acc = mean(acc)) %>%
ungroup() %>%
ggplot(aes(x = block, y = acc, group = sj, colour = sj)) +
geom_line() +
coord_cartesian(ylim = c(0, 1)) +
scale_x_discrete(limits = factor(1:10)) +
geom_hline(yintercept = 0.75,
linetype = 'dashed',
color = 'red',
size = 1)
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
ggplotly(plot_acc_block_sj)
Plot RTs by subject
plot_RT_sj <-
exp3_rowData %>%
filter(acc == 1) %>%
group_by(sj) %>%
ggplot(aes(x = sj, y = RT)) +
geom_violin(draw_quantiles = c(0.25, 0.5, 0.75))
ggplotly(plot_RT_sj)
Plot RT by block and subject
plot_RTs_block_sj <-
exp3_rowData %>%
filter(acc == 1) %>%
group_by(sj, block) %>%
summarise(RT = mean(RT)) %>%
ggplot(aes(x = block, y = RT, group = sj, colour = sj)) +
geom_line() +
scale_x_discrete(limits = factor(1:10))
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
ggplotly(plot_RTs_block_sj)
Excluded participants:
exp3_excludedSJ <-
exp3_rowData %>%
filter(!(sj %in% c('sj27')))
Removed trials:
# filler: 0 = experimental trial, 1 = filler trial
exp3_no_filler <-
exp3_excludedSJ %>%
filter(filler == 0 & probe_type == 'product')
Problems selected for the analysis:
exp3_no_filler %>%
select('op1', 'op2') %>%
table %>%
make_table('Problems selected')
| 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|
| 3 | 0 | 0 | 435 | 435 | 435 | 0 |
| 4 | 0 | 870 | 435 | 0 | 435 | 435 |
| 5 | 435 | 435 | 870 | 435 | 435 | 435 |
| 6 | 435 | 0 | 435 | 870 | 435 | 435 |
| 7 | 435 | 435 | 435 | 435 | 870 | 0 |
| 8 | 0 | 435 | 435 | 435 | 0 | 0 |
Table with accuracy mean, standard deviation and standard error (aggregated on subject and condition)
# Calculate statistics for accuracy
exp3_stats_acc <-
exp3_no_filler %>%
return_stats(c('SOA', 'problem_size', 'prime_cond'), DV = 'acc')
#> `summarise()` has grouped output by 'sj', 'SOA', 'problem_size'. You can override using the `.groups` argument.
#> `summarise()` has grouped output by 'SOA', 'problem_size'. You can override using the `.groups` argument.
exp3_stats_acc %>%
make_table('Accuracy by problem_size and prime_cond')
| SOA | problem_size | prime_cond | N_sj | Mean | SD | SE |
|---|---|---|---|---|---|---|
| SOA_050 | large | neigh_con | 29 | 0.94 | 0.07 | 0.01 |
| SOA_050 | large | neigh_inc | 29 | 0.92 | 0.09 | 0.02 |
| SOA_050 | large | neutral | 29 | 0.92 | 0.10 | 0.02 |
| SOA_050 | large | unrel_con | 29 | 0.94 | 0.07 | 0.01 |
| SOA_050 | large | unrel_inc | 29 | 0.93 | 0.08 | 0.01 |
| SOA_050 | small | neigh_con | 29 | 0.95 | 0.06 | 0.01 |
| SOA_050 | small | neigh_inc | 29 | 0.95 | 0.06 | 0.01 |
| SOA_050 | small | neutral | 29 | 0.96 | 0.05 | 0.01 |
| SOA_050 | small | unrel_con | 29 | 0.97 | 0.05 | 0.01 |
| SOA_050 | small | unrel_inc | 29 | 0.96 | 0.06 | 0.01 |
| SOA_170 | large | neigh_con | 29 | 0.92 | 0.10 | 0.02 |
| SOA_170 | large | neigh_inc | 29 | 0.90 | 0.08 | 0.02 |
| SOA_170 | large | neutral | 29 | 0.93 | 0.09 | 0.02 |
| SOA_170 | large | unrel_con | 29 | 0.92 | 0.11 | 0.02 |
| SOA_170 | large | unrel_inc | 29 | 0.92 | 0.11 | 0.02 |
| SOA_170 | small | neigh_con | 29 | 0.96 | 0.06 | 0.01 |
| SOA_170 | small | neigh_inc | 29 | 0.97 | 0.04 | 0.01 |
| SOA_170 | small | neutral | 29 | 0.96 | 0.05 | 0.01 |
| SOA_170 | small | unrel_con | 29 | 0.97 | 0.05 | 0.01 |
| SOA_170 | small | unrel_inc | 29 | 0.97 | 0.04 | 0.01 |
| SOA_220 | large | neigh_con | 29 | 0.94 | 0.07 | 0.01 |
| SOA_220 | large | neigh_inc | 29 | 0.94 | 0.07 | 0.01 |
| SOA_220 | large | neutral | 29 | 0.93 | 0.08 | 0.01 |
| SOA_220 | large | unrel_con | 29 | 0.92 | 0.09 | 0.02 |
| SOA_220 | large | unrel_inc | 29 | 0.93 | 0.10 | 0.02 |
| SOA_220 | small | neigh_con | 29 | 0.95 | 0.06 | 0.01 |
| SOA_220 | small | neigh_inc | 29 | 0.95 | 0.06 | 0.01 |
| SOA_220 | small | neutral | 29 | 0.97 | 0.04 | 0.01 |
| SOA_220 | small | unrel_con | 29 | 0.96 | 0.05 | 0.01 |
| SOA_220 | small | unrel_inc | 29 | 0.94 | 0.06 | 0.01 |
Tables are created with the my function return_info()
tb <-
return_info(exp3_no_filler)
tb$gender
| gender | n | percent |
|---|---|---|
| female | 18 | 62.07 |
| male | 11 | 37.93 |
tb$age
| mean | sd | min | max |
|---|---|---|---|
| 27.55 | 6.26 | 18 | 39 |
tb$error
| N_error | N_trial | percent_error |
|---|---|---|
| 728 | 13050 | 5.58 |
tb$omitted
| N_omitted | N_trial | percent_omitted |
|---|---|---|
| 80 | 13050 | 0.61 |
tb$timing
| N_wrong_timing | N_trial | percent_wrong_timing |
|---|---|---|
| 3 | 13050 | 0.02 |
tb$less_200
| N_less_200 | N_trial | percent_less_200 |
|---|---|---|
| 11 | 13050 | 0.08 |
Exclude trials with omitted answer, errors, RT less than 200 ms, and wrong timing (wrong stimuli onset/offset)
# Exclude omitted, errors, RT < 200 ms, and wrong timing
exp3_correct_ans <-
exp3_no_filler %>%
filter((acc == 1) & (RT > 200) & (timing == 'ok'))
For each participant, trials more than 2.5 standard deviations from the mean are classified as outliers and excluded from the frequentist analysis.
# identify outlier
threshold = 2.5
exp3_rt_outlier <-
exp3_correct_ans %>%
group_by(sj) %>%
mutate(outlier = !between(
RT,
mean(RT) - (threshold * sd(RT)),
mean(RT) + (threshold * sd(RT))
)) %>%
ungroup()
# percentage outliers
exp3_rt_outlier %>%
summarise(
N_outlier = sum(outlier == TRUE),
N_trial = length(outlier)
) %>%
mutate(percent_outlier = N_outlier / N_trial * 100) %>%
make_table('Outliers')
| N_outlier | N_trial | percent_outlier |
|---|---|---|
| 399 | 12314 | 3.24 |
Plot the trials classified as outliers
plot_outlier <-
ggplot(data = exp3_rt_outlier) +
geom_boxplot(aes(x = sj, y = RT)) +
geom_point(aes(x = sj, y = RT, colour = outlier),
position = position_dodge(0.9, preserve = 'total'),
shape = 20,
size = 0.5) +
theme(axis.text.x = element_text(angle = 50, vjust = 1, hjust = 1))
ggplotly(plot_outlier)
The processed data are saved in the file data/processed/exp3_data.rds.
saveRDS(
object = exp3_rt_outlier,
file = here('data', 'processed', 'exp3_data.rds'))
xfun::session_info()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19044)
#>
#> Locale:
#> LC_COLLATE=English_United Kingdom.1252
#> LC_CTYPE=English_United Kingdom.1252
#> LC_MONETARY=English_United Kingdom.1252
#> LC_NUMERIC=C
#> LC_TIME=English_United Kingdom.1252
#>
#> Package version:
#> askpass_1.1 assertthat_0.2.1 backports_1.2.1
#> base64enc_0.1.3 BH_1.75.0.0 blob_1.2.1
#> broom_0.7.6 bslib_0.2.4 callr_3.6.0
#> cellranger_1.1.0 cli_2.4.0 clipr_0.7.1
#> colorspace_2.0-0 compiler_4.0.5 cpp11_0.2.7
#> crayon_1.4.1 crosstalk_1.1.1 curl_4.3
#> data.table_1.14.0 DBI_1.1.1 dbplyr_2.1.1
#> digest_0.6.27 dplyr_1.0.5 dtplyr_1.1.0
#> ellipsis_0.3.1 evaluate_0.14 fansi_0.4.2
#> farver_2.1.0 forcats_0.5.1 fs_1.5.0
#> gargle_1.1.0 generics_0.1.0 ggplot2_3.3.5
#> glue_1.4.2 googledrive_1.0.1 googlesheets4_0.3.0
#> graphics_4.0.5 grDevices_4.0.5 grid_4.0.5
#> gtable_0.3.0 haven_2.3.1 here_1.0.1
#> highr_0.8 hms_1.0.0 htmltools_0.5.1.1
#> htmlwidgets_1.5.3 httr_1.4.2 ids_1.0.1
#> isoband_0.2.4 janitor_2.1.0 jquerylib_0.1.3
#> jsonlite_1.7.2 kableExtra_1.3.4 knitr_1.33
#> labeling_0.4.2 later_1.1.0.1 lattice_0.20.41
#> lazyeval_0.2.2 lifecycle_1.0.0 lubridate_1.7.10
#> magrittr_2.0.1 markdown_1.1 MASS_7.3.53.1
#> Matrix_1.3.2 methods_4.0.5 mgcv_1.8.34
#> mime_0.10 modelr_0.1.8 munsell_0.5.0
#> nlme_3.1.152 openssl_1.4.3 pillar_1.6.0
#> pkgconfig_2.0.3 plotly_4.9.3 prettyunits_1.1.1
#> processx_3.5.1 progress_1.2.2 promises_1.2.0.1
#> ps_1.6.0 purrr_0.3.4 R6_2.5.0
#> rappdirs_0.3.3 RColorBrewer_1.1.2 Rcpp_1.0.6
#> readr_1.4.0 readxl_1.3.1 rematch_1.0.1
#> rematch2_2.1.2 reprex_2.0.0 rlang_0.4.10
#> rmarkdown_2.7 rprojroot_2.0.2 rstudioapi_0.13
#> rvest_1.0.0 sass_0.3.1 scales_1.1.1
#> selectr_0.4.2 snakecase_0.11.0 splines_4.0.5
#> stats_4.0.5 stringi_1.5.3 stringr_1.4.0
#> svglite_2.0.0 sys_3.4 systemfonts_1.0.2
#> tibble_3.1.0 tidyr_1.1.3 tidyselect_1.1.0
#> tidyverse_1.3.1 tinytex_0.31 tools_4.0.5
#> utf8_1.2.1 utils_4.0.5 uuid_0.1.4
#> vctrs_0.3.7 viridisLite_0.3.0 webshot_0.5.2
#> withr_2.4.1 xfun_0.22 xml2_1.3.2
#> yaml_2.2.1